package com.lucenly.spell.view.dialog

import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import com.lucenly.spell.R
import com.moregold.mvvmlib.ext.ext_doubleClick

class ContactDialog(context:Context,type:Int) : Dialog(context, R.style.DialogStyle){

    init {
        val view = layoutInflater.inflate(R.layout.dialog_contact,null)
        setContentView(view)
        setCanceledOnTouchOutside(false)
        val tvSure = view.findViewById<TextView>(R.id.tvSure)
        val tvTitle = view.findViewById<TextView>(R.id.tvTitle)
        val tvMsg = view.findViewById<TextView>(R.id.tvMsg)
        if (type==0){//0 联系客服   加入官方交流群
            tvTitle.text = "联系客服"
            tvMsg.text = "添加微信：pinbudao214"
        }else{
            tvTitle.text = "加入官方交流群"
            tvMsg.text = "加入官方交流群：pinbudao214"
        }
        tvSure.ext_doubleClick {
            dismiss()
        }
        val window = window
        if (window != null) {
            val params = window.attributes
            params.width = LinearLayout.LayoutParams.MATCH_PARENT
            params.height = LinearLayout.LayoutParams.MATCH_PARENT
            params.gravity = Gravity.BOTTOM
            window.attributes = params
        }
    }
}